<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片阴影</title>
    <style>
        body {
            background-color: #f5f5f5;
        }

        .container {
            width: 980px;
            margin: 50px auto;
        }

        .img {
            position: relative;
            width: 230px;
            height: 300px;
            float: left;
            cursor: pointer;
            margin: 0 20px 20px 0;
        }

        .img img {
            width: 230px;
            height: 300px;
            margin: 0;
        }

        .img:nth-child(4n) {
            margin-right: 0;
        }

        .img:hover {
            top: -2px;
            box-shadow: 0 15px 30px rgba(0, 0, 0, .3)
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="img">
            <img src="item.png" alt="">
        </div>
        <div class="img">
            <img src="item.png" alt="">
        </div>
        <div class="img">
            <img src="item.png" alt="">
        </div>
        <div class="img">
            <img src="item.png" alt="">
        </div>
        <div class="img">
            <img src="item.png" alt="">
        </div>
        <div class="img">
            <img src="item.png" alt="">
        </div>
        <div class="img">
            <img src="item.png" alt="">
        </div>
        <div class="img last">
            <img src="item.png" alt="">
        </div>
    </div>
</body>

</html>